package com.msk.base.service;

import com.msk.common.utils.spring.SpringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @desc: 生成合同线程
 * @author: zlf
 * @date: 2020-11-06 21:39
 **/
public class GenerateContratctThread extends Thread {

    private static Logger log = LoggerFactory.getLogger(GenerateContratctThread.class);

    private String id;

    private String detailId;

    private GenerateContractService generateContractService;

    public GenerateContratctThread(String id, String detailId) {
        this.id = id;
        this.detailId = detailId;
        generateContractService = SpringUtils.getBean(GenerateContractService.class);
    }

    @Override
    public void run() {
        try {
            long start = System.currentTimeMillis();
            generateContractService.generatePurchaseContract(id);
            generateContractService.generateSupplierContract(detailId);
            long end = System.currentTimeMillis();
            log.info("生成平台和货主合同及生成平台和承运商合同耗时："+(end-start));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
